#ifndef AUDIOPORTAUDIO_H
#define AUDIOPORTAUDIO_H

#include <QByteArray>



struct PaStreamParameters;
typedef void PaStream;

class AudioPortAudio
{
public:
    AudioPortAudio();
    ~AudioPortAudio();

    inline bool isOpen()
    {
        return stream;
    }

    void setParams( int chn, int sampleRate );

    bool open();
    bool close( const bool &stop );
    bool pause();

    bool write( uint8_t *buffer, const int &size );
    bool clear();
private:
    PaStreamParameters *outputParameters = nullptr;
    PaStream *stream=nullptr;
    int sampleRate = 44100;//采样率
    int channels = 2;
    bool initialized =false;
     int s =0;
};
#endif // AUDIOPORTAUDIO_H
